import java.util.Scanner;

public class D124 {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		
		while(sc.hasNext()) {
			char[] calculatedSpInput;
			do {
				String input = sc.nextLine();
				calculatedSpInput = input.toCharArray();
				if((calculatedSpInput[0] == '-'))
					{ calculatedSpInput = java.util.Arrays.copyOfRange(calculatedSpInput, 1, calculatedSpInput.length); }
			} while(false);
			
			int digitsSum = 0;
			for(int i = 0; i < calculatedSpInput.length; i++)
				{ digitsSum += Integer.parseInt(Character.toString(calculatedSpInput[i])); }
			
			String output = "";
			if((digitsSum % 3) == 0)
				{ output = "yes"; }
			else
				{ output = "no"; }
			
			System.out.println(output);
		} // hasNext
	} // main
}